package com.solute.web.main.result;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.solute.web.main.result.service.MainResultService;

@Controller
@RequestMapping(value="/main/result")
public class MainResultController {
	
	private @Autowired MainResultService service;
	
	private static final Logger logger = LoggerFactory.getLogger(MainResultController.class);
	
	@RequestMapping(method=RequestMethod.GET)
	public ModelAndView main() {
		return new ModelAndView("main.result");
	}
	
	@RequestMapping(value="/search", method=RequestMethod.POST)
	public @ResponseBody
	List<?> search(@RequestParam(value="searchParam", required=true) String searchParam) {
		return service.search(searchParam);
	}
}
